$fname = 'Setup.php';
$ps_setup = Profiler::instance()->scopedProfileIn( $fname );
-// If any extensions are still queued, force load them
+// Load queued extensions
ExtensionRegistry::getInstance()->loadFromQueue();
+// Don't let any other extensions load
+ExtensionRegistry::getInstance()->finish();
// Check to see if we are at the file scope
if ( !isset( $wgVersion ) ) {
*/
protected $queued = [];
+ /**
+ * Whether we are done loading things
+ *
+ * @var bool
+ */
+ private $finished = false;
+
/**
* Items in the JSON file that aren't being
* set as globals
$this->queued[$path] = $mtime;
}
+ /**
+ * @throws MWException If the queue is already marked as finished (no further things should
+ * be loaded then).
+ */
public function loadFromQueue() {
global $wgVersion;
if ( !$this->queued ) {
return;
}
+ if ( $this->finished ) {
+ throw new MWException(
+ "The following paths tried to load late: "
+ . implode( ', ', array_keys( $this->queued ) )
+ );
+ }
+
// A few more things to vary the cache on
$versions = [
'registration' => self::CACHE_VERSION,
$this->queued = [];
}
+ /**
+ * After this is called, no more extensions can be loaded
+ *
+ * @since 1.29
+ */
+ public function finish() {
+ $this->finished = true;
+ }
+
/**
* Process a queue of extensions and return their extracted data
*